<?php
/**
 * @file notice_sidebar.php
 * @author LD
 * @package kkyoo_home
 * @desc 获得公告和帮助列表
 */
require_once 'NoticeCore.class.php';
global $Options;

$queryHead = "SELECT `ID`, `title`, DATE_FORMAT(`date`, '%y-%m-%d') as time "
	." FROM ".DB_NAME_ROOMS.".tbl_rooms_news WHERE `category_id` = ";
$queryTail = " AND `status` = 'publish' ORDER BY `date` DESC LIMIT 5;";

// 公告板块
foreach ($Options['catNums'] as $cat){
	$newsArr[$cat] = array();
	$newsRe = NoticeCore::sql2Arrs( $queryHead.$cat.$queryTail );

	foreach ($newsRe as $row){
		if ( mb_strlen($row['title']) > 12 )
			$row['name'] = mb_substr($row['title'], 0, 12, 'UTF-8');
		else $row['name'] = $row['title'];
		array_push($newsArr[$cat], $row);
	}
}

//var_dump($newsArr);
?>
<script type="text/javascript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
//-->
</script>
<table width="276" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td height="213" valign="top">
		<div id="tab1">
		<table width="276" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td height="29" background="images/tabbg2.gif">
				<table width="276" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td align="left"><img src="images/tab1a.gif" width="90" height="29" /></td>
						<td align="center"><img src="images/tab2b.gif" width="90" height="29"
							onmouseover="MM_showHideLayers('tab1','','hide','tab2','','show')" /></td>
						<td align="right"><img src="images/tab3b.gif" width="90"
							height="29"
							onmouseover="MM_showHideLayers('tab1','','hide','tab3','','show')" /></td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		<table width="276" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="1" height="172" bgcolor="#a5bfeb"></td>
				<td width="274" height="175" align="center" valign="top">
				<table width="91%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td align="left">
						

<?php foreach ($newsArr[2] as $node): ?>
<table cellspacing="0" cellpadding="4" width="249" border="0">
<tbody>
	<tr>
	<td width="13" align="right"><img height="6" src="images/arrow1.gif" width="6" /></td>
	<td align="left" width="162">
		<a title="<?php echo $node['title']; ?>" href="<?php echo "notice/index.php?controller=post&action=view&nid=".$node['ID']; ?>">
			<?php echo $node['name']; ?>
	</a></td>
	<td align="left" width="50"><?php echo $node['time'] ?></td>
	</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" width="100%" border="0">
	<tbody><tr><td bgcolor="#ededed" height="1"></td></tr></tbody>
</table>
<?php endforeach; ?>	

						</td>
					</tr>
				</table>
				<table width="91%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td align="right" valign="bottom">
							<a href="<?php echo $Options['newsUrl']; ?>"><img src="images/more3.gif" width="40" height="13" border="0" /></a>
						</td>
					</tr>
				</table>
				</td>
				<td width="1" bgcolor="#a5bfeb"></td>
			</tr>
		</table>
		<table width="276" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="6" height="7"><img src="images/bl.gif" width="6"
					height="7" /></td>
				<td width="264" background="images/bbg.gif"><img
					src="images/bbg.gif" width="14" height="7" /></td>
				<td width="6" height="7"><img src="images/br.gif" width="6"
					height="7" /></td>
			</tr>
		</table>
		</div>
		<div id="tab2">
		<table width="276" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td height="29" background="images/tabbg2.gif">
				<table width="276" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td align="left"><img src="images/tab1b.gif" width="90"
							height="29" onmouseover="MM_showHideLayers('tab1','','show','tab2','','hide')" /></td>
						<td align="center"><img src="images/tab2a.gif" width="90" height="29" /></td>
						<td align="right"><img src="images/tab3b.gif" width="90"
							height="29" onmouseover="MM_showHideLayers('tab2','','hide','tab3','','show')" /></td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		<table width="276" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="1" height="172" bgcolor="#a5bfeb"></td>
				<td width="274" height="175" align="center" valign="top">
				<table width="91%" height="160" border="0" cellpadding="0"
					cellspacing="0">
					<tr>
						<td align="left" valign="top">
<?php foreach ($newsArr[1] as $node): ?>
<table cellspacing="0" cellpadding="4" width="249" border="0">
<tbody>
	<tr>
	<td width="13" align="right"><img height="6" src="images/arrow1.gif" width="6" /></td>
	<td align="left" width="162">
		<a title="<?php echo $node['title']; ?>" href="<?php echo "notice/index.php?controller=post&action=view&nid=".$node['ID']; ?>">
			<?php echo $node['name']; ?>
	</a></td>
	<td align="left" width="50"><?php echo $node['time'] ?></td>
	</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" width="100%" border="0">
	<tbody><tr><td bgcolor="#ededed" height="1"></td></tr></tbody>
</table>
<?php endforeach; ?>	
						</td>
					</tr>
				</table>
				<table width="91%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td align="right" valign="bottom">
							<a href="<?php echo $Options['newsUrl']; ?>"><img src="images/more3.gif" width="40" height="13" border="0" /></a>
						</td>
					</tr>
				</table>
				</td>
				<td width="1" bgcolor="#a5bfeb"></td>
			</tr>
		</table>
		<table width="276" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="6" height="7"><img src="images/bl.gif" width="6"
					height="7" /></td>
				<td width="264" background="images/bbg.gif"><img
					src="images/bbg.gif" width="14" height="7" /></td>
				<td width="6" height="7"><img src="images/br.gif" width="6"
					height="7" /></td>
			</tr>
		</table>
		</div>
		<div id="tab3">
		<table width="276" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td height="29" background="images/tabbg2.gif">
				<table width="276" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td align="left"><img src="images/tab1b.gif" width="90"
							height="29"
							onmouseover="MM_showHideLayers('tab1','','show','tab3','','hide')" /></td>
						<td align="center"><img src="images/tab2b.gif" width="90"
							height="29"
							onmouseover="MM_showHideLayers('tab2','','show','tab3','','hide')" /></td>
						<td align="right"><img src="images/tab3a.gif" width="90"
							height="29" /></td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		<table width="276" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="1" height="172" bgcolor="#a5bfeb"></td>
				<td width="274" height="175" align="center" valign="top">
				<table width="91%" height="160" border="0" cellpadding="0"
					cellspacing="0">
					<tr>
						<td align="left" valign="top">
<?php foreach ($newsArr[3] as $node): ?>
<table cellspacing="0" cellpadding="4" width="249" border="0">
<tbody>
	<tr>
	<td width="13" align="right"><img height="6" src="images/arrow1.gif" width="6" /></td>
	<td align="left" width="162">
		<a title="<?php echo $node['title']; ?>" href="<?php echo "notice/index.php?controller=post&action=view&nid=".$node['ID']; ?>">
			<?php echo $node['name']; ?>
	</a></td>
	<td align="left" width="50"><?php echo $node['time'] ?></td>
	</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" width="100%" border="0">
	<tbody><tr><td bgcolor="#ededed" height="1"></td></tr></tbody>
</table>
<?php endforeach; ?>	
						</td>
					</tr>
				</table>
				<table width="91%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td align="right" valign="bottom">
							<a href="<?php echo $Options['newsUrl']; ?>"><img src="images/more3.gif" width="40" height="13" border="0" /></a>
						</td>
					</tr>
				</table>
				</td>
				<td width="1" bgcolor="#a5bfeb"></td>
			</tr>
		</table>
		<table width="276" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="6" height="7"><img src="images/bl.gif" width="6"
					height="7" /></td>
				<td width="264" background="images/bbg.gif"><img
					src="images/bbg.gif" width="14" height="7" /></td>
				<td width="6" height="7"><img src="images/br.gif" width="6"
					height="7" /></td>
			</tr>
		</table>
		</div>
		</td>
	</tr>
</table>

<table width="80%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td height="7"></td>
	</tr>
</table>
<table width="276" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td height="191" align="left" valign="top">
<div id="Layer9">
		<table width="276" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td height="29" background="images/tabbg2.gif">
				<table width="276" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td align="left"><img src="images/tab4a.gif" width="90" height="29" /></td>
						<td align="center"><img src="images/tab5b.gif" width="90" height="29"
							onmouseover="MM_showHideLayers('Layer9','','hide','Layer10','','show')" /></td>
						<td align="right"><img src="images/tab6b.gif" width="90" height="29"
							onmouseover="MM_showHideLayers('Layer9','','hide','Layer11','','show')" /></td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="1" height="155" bgcolor="#a5bfeb"></td>
				<td align="center" valign="top">
				<table width="91%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td align="left">
<?php foreach ($newsArr[13] as $node): ?>
<table cellspacing="0" cellpadding="4" width="249" border="0">
<tbody>
	<tr>
	<td width="13" align="right"><img height="6" src="images/arrow1.gif" width="6" /></td>
	<td align="left" width="162">
		<a title="<?php echo $node['title']; ?>" href="<?php echo "notice/index.php?controller=help&nid=".$node['ID']; ?>">
			<?php echo $node['name']; ?>
	</a></td>
	<td align="left" width="50"><?php echo $node['time'] ?></td>
	</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" width="100%" border="0">
	<tbody><tr><td bgcolor="#ededed" height="1"></td></tr></tbody>
</table>
<?php endforeach; ?>	
						</td>
					</tr>
				</table>
				<table width="91%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td height="17" align="right" valign="bottom">
							<a href="<?php echo $Options['helpUrl']; ?>">
							<img src="images/more3.gif" width="40" height="13" border="0" /></a></td>
					</tr>
				</table>
				</td>
				<td width="1" bgcolor="#a5bfeb"></td>
			</tr>
		</table>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="6" height="7"><img src="images/bl.gif" width="6"
					height="7" /></td>
				<td width="264" background="images/bbg.gif"><img
					src="images/bbg.gif" width="14" height="7" /></td>
				<td width="6" height="7"><img src="images/br.gif" width="6"
					height="7" /></td>
			</tr>
		</table>
		</div>
<div id="Layer10">
		<table width="276" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td height="29" background="images/tabbg2.gif">
				<table width="276" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td align="left"><img src="images/tab4b.gif" width="90"
							height="29"
							onmouseover="MM_showHideLayers('Layer9','','show','Layer10','','hide')" /></td>
						<td align="center"><img src="images/tab5a.gif" width="90"
							height="29" /></td>
						<td align="right"><img src="images/tab6b.gif" width="90"
							height="29"
							onmouseover="MM_showHideLayers('Layer10','','hide','Layer11','','show')" /></td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="1" height="155" bgcolor="#a5bfeb"></td>
				<td align="center" valign="top">
				<table width="91%" height="135" border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td align="left" valign="top">
<?php foreach ($newsArr[14] as $node): ?>
<table cellspacing="0" cellpadding="4" width="249" border="0">
<tbody>
	<tr>
	<td width="13" align="right"><img height="6" src="images/arrow1.gif" width="6" /></td>
	<td align="left" width="162">
		<a title="<?php echo $node['title']; ?>" href="<?php echo "notice/index.php?controller=help&nid=".$node['ID']; ?>">
			<?php echo $node['name']; ?>
	</a></td>
	<td align="left" width="50"><?php echo $node['time'] ?></td>
	</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" width="100%" border="0">
	<tbody><tr><td bgcolor="#ededed" height="1"></td></tr></tbody>
</table>
<?php endforeach; ?>							
						</td>
					</tr>
				</table>
				<table width="91%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td height="17" align="right" valign="bottom">
							<a href="<?php echo $Options['helpUrl']; ?>">
							<img src="images/more3.gif" width="40" height="13" border="0" /></a></td>
					</tr>
				</table>
				</td>
				<td width="1" bgcolor="#a5bfeb"></td>
			</tr>
		</table>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="6" height="7"><img src="images/bl.gif" width="6"
					height="7" /></td>
				<td width="264" background="images/bbg.gif"><img
					src="images/bbg.gif" width="14" height="7" /></td>
				<td width="6" height="7"><img src="images/br.gif" width="6"
					height="7" /></td>
			</tr>
		</table>
		</div>
<div id="Layer11">
		<table width="276" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td height="29" background="images/tabbg2.gif">
				<table width="276" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td align="left"><img src="images/tab4b.gif" width="90"
							height="29"
							onmouseover="MM_showHideLayers('Layer9','','show','Layer11','','hide')" /></td>
						<td align="center"><img src="images/tab5b.gif" width="90"
							height="29"
							onmouseover="MM_showHideLayers('Layer10','','show','Layer11','','hide')" /></td>
						<td align="right"><img src="images/tab6a.gif" width="90"
							height="29" /></td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="1" height="155" bgcolor="#a5bfeb"></td>
				<td align="center" valign="top">
				<table width="91%" height="135" border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td align="center" valign="top">
<?php foreach ($newsArr[15] as $node): ?>
<table cellspacing="0" cellpadding="4" width="249" border="0">
<tbody>
	<tr>
	<td width="13" align="right"><img height="6" src="images/arrow1.gif" width="6" /></td>
	<td align="left" width="162">
		<a title="<?php echo $node['title']; ?>" href="<?php echo "notice/index.php?controller=help&action=faq#".$node['ID']; ?>">
			<?php echo $node['name']; ?>
	</a></td>
	<td align="left" width="50"><?php echo $node['time'] ?></td>
	</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" width="100%" border="0">
	<tbody><tr><td bgcolor="#ededed" height="1"></td></tr></tbody>
</table>
<?php endforeach; ?>
						</td>
					</tr>
		</table>
				<table width="91%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td height="17" align="right" valign="bottom">
							<a href="<?php echo $Options['helpUrl']; ?>">
							<img src="images/more3.gif" width="40" height="13" border="0" /></a></td>
					</tr>
				</table>
	</td>
				<td width="1" bgcolor="#a5bfeb"></td>
			</tr>
		</table>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="6" height="7"><img src="images/bl.gif" width="6"
					height="7" /></td>
				<td width="264" background="images/bbg.gif"><img
					src="images/bbg.gif" width="14" height="7" /></td>
				<td width="6" height="7"><img src="images/br.gif" width="6"
					height="7" /></td>
			</tr>
		</table>
</div>		
		</td>
	</tr>
</table>
<table width="80%" border="0" cellspacing="0" cellpadding="0">
	<tr><td height="7"></td></tr>
</table>